<?php
/**
 * 购物车--接口
 */

namespace app\frontend\controllers\shopcart;

use App\common\components\BaseController;

class ShopCartController extends BaseController
{

    public function index()
    {
        $cart_id = request()->input('cart_id', 0);

        $data = [
            'id' => $cart_id
        ];
        return successJson('ok', $data);
    }

    /**
     * 加入购物车
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function addCart()
    {
        //获取数据
        $data = self::getData('ShopCart', 'addCart');
        return successJson('ok', $data);
    }

    /**
     * 购物车列表接口
     * @return \Illuminate\Http\JsonResponse
     */
    public function  cartLists()
    {
        //获取数据
        $data = self::getData('ShopCart', 'cartLists');
        return successJson('ok', $data);
    }

    /**
     * 购物车满减优惠
     * @return \Illuminate\Http\JsonResponse
     */
    public function  cartPreference()
    {
        //获取数据
        $data = self::getData('ShopCart', 'cartPreference');
        return successJson('ok', $data);
    }

}

